public class Statements {

	private Statement statement;
	private Statements stmtSeq;

	public Statements(Tokens tokens) {
		this.parse(tokens);
	}
	
	public void parse(Tokens tokens) {
		// check if token is either "if, while, read, write" and an ID
		if(tokens.getToken() == 5 || tokens.getToken() == 8 || tokens.getToken() == 10 
				|| tokens.getToken() == 11 || tokens.getToken() == 32){
			this.statement = new Statement(tokens);
		} else{
			System.err.println("Invalid Statement Sequence: " + tokens.idName());
			System.exit(0);
		} // if there is another statement sequence, recursively call another Stmt_Seq
		if(tokens.getToken() == 5 || tokens.getToken() == 8 || tokens.getToken() == 10 
				|| tokens.getToken() == 11 || tokens.getToken() == 32){
			this.stmtSeq = new Statements(tokens);
		}
	}
	
	public void runStmtSeq(){
		if(this.statement != null){
			this.statement.runStmt();
			if(this.stmtSeq != null){
				this.stmtSeq.runStmtSeq();
			}
		}
	}
}